package cn.cyb.server.common.utils;

import com.google.gson.Gson;
import com.google.gson.JsonSyntaxException;

import java.util.Map;

/**
 * @author yuebo
 * @date 2024/12/25
 */
public class JsonUtils {

    public static String toJsonString(Object object) {
        return new Gson().toJson(object);
    }

    public static Map toMap(String json) {
        try {
            return new Gson().fromJson(json, Map.class);
        } catch (JsonSyntaxException e) {
            e.printStackTrace();
        }
        return null;
    }
}
